package com.rongshe.hotel.service.impl;

import java.util.List;
import com.rongshe.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.rongshe.hotel.mapper.RsGoodUnitMapper;
import com.rongshe.hotel.domain.RsGoodUnit;
import com.rongshe.hotel.service.IRsGoodUnitService;

/**
 * 商品规格Service业务层处理
 * 
 * @author rongshe
 * @date 2025-02-18
 */
@Service
public class RsGoodUnitServiceImpl implements IRsGoodUnitService 
{
    @Autowired
    private RsGoodUnitMapper rsGoodUnitMapper;

    /**
     * 查询商品规格
     * 
     * @param id 商品规格主键
     * @return 商品规格
     */
    @Override
    public RsGoodUnit selectRsGoodUnitById(Long id)
    {
        return rsGoodUnitMapper.selectRsGoodUnitById(id);
    }

    /**
     * 查询商品规格列表
     * 
     * @param rsGoodUnit 商品规格
     * @return 商品规格
     */
    @Override
    public List<RsGoodUnit> selectRsGoodUnitList(RsGoodUnit rsGoodUnit)
    {
        return rsGoodUnitMapper.selectRsGoodUnitList(rsGoodUnit);
    }

    /**
     * 新增商品规格
     * 
     * @param rsGoodUnit 商品规格
     * @return 结果
     */
    @Override
    public int insertRsGoodUnit(RsGoodUnit rsGoodUnit)
    {
        rsGoodUnit.setCreateTime(DateUtils.getNowDate());
        return rsGoodUnitMapper.insertRsGoodUnit(rsGoodUnit);
    }

    /**
     * 修改商品规格
     * 
     * @param rsGoodUnit 商品规格
     * @return 结果
     */
    @Override
    public int updateRsGoodUnit(RsGoodUnit rsGoodUnit)
    {
        rsGoodUnit.setUpdateTime(DateUtils.getNowDate());
        return rsGoodUnitMapper.updateRsGoodUnit(rsGoodUnit);
    }

    /**
     * 批量删除商品规格
     * 
     * @param ids 需要删除的商品规格主键
     * @return 结果
     */
    @Override
    public int deleteRsGoodUnitByIds(Long[] ids)
    {
        return rsGoodUnitMapper.deleteRsGoodUnitByIds(ids);
    }

    /**
     * 删除商品规格信息
     * 
     * @param id 商品规格主键
     * @return 结果
     */
    @Override
    public int deleteRsGoodUnitById(Long id)
    {
        return rsGoodUnitMapper.deleteRsGoodUnitById(id);
    }
}
